<?php

namespace App\Models;

use Slowlyo\OwlAdmin\Models\BaseModel as Model;
use Slowlyo\OwlAdmin\Models\AdminUser;
/**
 * 上游管理
 */
class UpCustomer extends Model
{

	protected $table = 'up_customer';
	protected static function boot()
	{
		parent::boot();

		static::creating(function ($model) {
			$model->created_at = date('Y-m-d H:i:s');
			$model->updated_at = date('Y-m-d H:i:s');
			$model->operator_uid = admin_user()->id;
			$model->editor_uid = admin_user()->id;
		});

		static::updating(function ($model) {
			$model->updated_at = date('Y-m-d H:i:s');
			$model->editor_uid = admin_user()->id;
		});
	}

	/**
     * 获取操作人信息
     */
    public function operator()
    {
        return $this->belongsTo(AdminUser::class, 'operator_uid');
    }

	/**
     * 获取对接人信息
     */
    public function bd_uid()
    {
        return $this->belongsTo(AdminUser::class, 'bd_uid');
    }

	/**
     * 获取签约公司信息
     */
    public function sign_company()
    {
        return $this->belongsTo(Company::class, 'sign_company');
    }
	
}